package com.huluobo.a2303mdmdemo.demo

import android.util.Log
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Send
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.ElevatedButton
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.OutlinedButton
import androidx.compose.material3.OutlinedIconButton
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.dp

/**
 *  Created by LC on 2025/8/15.
 */
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun MyButton() {
    Column(verticalArrangement = Arrangement.spacedBy(10.dp), modifier = Modifier.padding(10.dp)) {
        Button(
            onClick = {
                Log.e("TagA", "点击了按钮")
            }, modifier = Modifier
                .size(140.dp)
                .clip(CircleShape),
            //修改按钮颜色
            colors = ButtonDefaults.buttonColors(
                //容器的颜色
                containerColor = Color.Red,
                //内容的颜色
                contentColor = Color.Black,
                //不可点击时容器的颜色
                disabledContainerColor = Color.Green,
                //不可点击时内容的颜色
                disabledContentColor = Color.LightGray
            ),
            enabled = true
        ) {
            Column {
                Text(text = "按钮")
                Icon(imageVector = Icons.Default.Add, contentDescription = "")
            }
        }

        OutlinedButton(onClick = {}) {
            Text(text = "OutlinedButton")
        }

        ElevatedButton(onClick = {}) {
            Text(text = "ElevatedButton")
        }

        TextButton(onClick = {}) {
            Text(text = "TextButton")
        }

        OutlinedIconButton(onClick = {}) {
            Icon(imageVector = Icons.Default.Send, contentDescription = "")
        }

        TextField(value = "", onValueChange = {}, colors = TextFieldDefaults.textFieldColors(
            containerColor = Color.White,
            focusedIndicatorColor = Color.White
        ), label = {
            Text(text = "请输入用户名")
        })

        TextField(value = "", onValueChange = {}, colors = TextFieldDefaults.textFieldColors(
            containerColor = Color.White,
            //获取焦点时指示器的颜色
            focusedIndicatorColor = Color.White,
            //失去焦点时指示器的颜色
            unfocusedIndicatorColor = Color.White
        ), label = {
            Text(text = "请输入用户名")
        })
    }

}